#include <iostream>
#include <vector>
using namespace std;

int findMaxLength(vector<int>& nums)
{
	if(nums.size() == 0){
		return 0;
	}
	long long int sum[nums.size()];
	long long counter=0;
	long long res=0;
	for(unsigned int i=0;i!=nums.size();++i){
		counter+=nums[i];
		sum[i]=counter;
	}
	for(unsigned int i=0;i<nums.size();++i){
		for(unsigned int j=i+1;j<nums.size();++j){
			long long left=sum[j];
			long long right=(i == 0)?(0):(sum[i-1]);
			if(((left - right)*2 == (j-i+1)) && ((j-i+1)>res)){
				res = j-i+1;
			}
		}
	}
	return res;
}


int main(int argc, char *argv[])
{
	vector<int> a={1,0};
	cout<<findMaxLength(a)<<endl;
	return 0;
}

